
const Controller = require('egg').Controller;
var a = 0
class TestController extends Controller {
  async index() {

    // await this.app.model.Info.create({
    //   info_name:1
    // })
    // await this.app.model.Info.create({
    //   info_name:2
    // })
    // await this.app.model.Haha.create({
    //   project_name: 1,name:"小红"
    // })
    // await this.app.model.Haha.create({
    //   project_name: 1,name:"小蓝"
    // })
    // await this.app.model.Haha.create({
    //   project_name: 2,name:"小乌龟"
    // })
    // await this.app.model.Haha.create({
    //   project_name: 2,name:"小王八"
    // })
    // await this.app.model.User.create({
    //   username:"root", name:"123456", password:"123456",sex:"1", email:"1", phone:"123456", state:"1", project_name:"1", rolename_name:"1"
    // })
    await this.app.model.Project.create({
      name: "青龙",project_site:"青龙.",project_sketch:"青龙..",project_state:"a"
    })
    await this.app.model.Project.create({
      name: "山海关",project_site:"山海关.",project_sketch:"山海关..",project_state:"a"
    })
    // await this.app.model.Class.create({
    //   for_project: "山海关",teacher:"山海关的小红",state:0,class_name:"1班"
    // })
    // await this.app.model.Class.create({
    //   for_project: "山海关",teacher:"山海关的小蓝",state:0,class_name:"2班"
    // })
    // await this.app.model.Class.create({
    //   for_project: "青龙",teacher:"青龙的小红",state:0,class_name:"1班"
    // })
    // await this.app.model.Class.create({
    //   for_project: "青龙",teacher:"青龙的的小蓝",state:0,class_name:"2班"
    // })
    // let result = await this.ctx.model.Class.findAll({
    //   include: [{ model: this.ctx.model.Project, attributes: ['id','project_name'] }]
    // })
    // await this.app.model.Class.create({
    //   for_project: "abc",teacher:"青龙的的小蓝",state:0,class_name:"2班"
    // })
    // let result = await this.ctx.model.Project.findAll({
    //   include:[{model:this.ctx.model.Class,attributes:['class_name']}]
    // })
    // function a(){
    //   if(result){
    //     return result
    //   }else{
    //     return "ok"
    //   }
    // }
    
    this.ctx.body = a
  }

}

module.exports = TestController;
